﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Table_Dal;
using DAL;
using System.Data;
using System.Data.SqlClient;
namespace BLL
{
    public class QuantriBll
    {
        
        public int LogIn(string username, string password)
        {
            QuantriDal quantri = new QuantriDal();
            QuanTriTbl user = quantri.LogIn(username);
            if (user.MADANGNHAP == null)
                return 0;
            if (user.MADANGNHAP == username)
            {
                
                if (user.MATKHAU == password)
                     return 2;
                return 1;
            }
            return 0;
           
        } 
        public bool ThemQuanTri(QuanTriTbl Qtri)
        {
            QuantriDal quantri = new QuantriDal();
            return quantri.ThemQuanTri(Qtri);
        }
        
        public int PhanQuyen(string MaDangNhap)
        {
            QuantriDal qt = new QuantriDal();
            return qt.PhanQuyen(MaDangNhap);
        }
        public bool ThayDoiMatKhau(string MaDangNhap, string MatKhauMoi)
        {
            QuantriDal qt = new QuantriDal();
            return qt.ThayDoiMatKhau(MaDangNhap, MatKhauMoi);
        }
        public bool KiemTra_TrungKhoa(string ma)
        {
            QuantriDal qt = new QuantriDal();
            return qt.KiemTra_TrungKhoa(ma);
        }

        public QuanTriTbl Thongtin_User(string ma)
        {
            QuantriDal qt = new QuantriDal();
            return qt.Thongtin_User(ma);
        }
    }
}
